import request from '@/utils/request'
import { getToken } from '@/utils/auth'
export default{
  // 课程列表页------------------------
  getHealthycourseLists(page_num,page_size){
    return request({
      url:`/course/byType?page_num=${page_num}&page_size=${page_size}&sortWay=unSort&type=all`,
      method: 'GET',
    })
  },
  getHealthycourseList(page_num,page_size,searchObj){
    return request({
      url:`/course/selectthem/${page_num}/${page_size}`,
      method: 'POST',
      data:searchObj,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //课程删除设置
  delcourse(course_id){
    return request({
      method: 'DELETE',
		  url: '/course?course_id=' + course_id,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //课程添加提交submit设置
  adcourse(list){
    return request({
      method: 'POST',
      url: '/course',
      data:list
    })
  },
  //修改提交submit设置
  upcourse(list){
    return request({
      method: 'PUT',
      url: '/course',
      data:list
    })
  },
   //课程修改设置
   updatecourse(id){
    return request({
        method: 'GET',
        url: '/course?course_id=' + id,
    })
  },
  //查看课程详情
  detailcourse(id){
    return request({
      method:'GET',
      url:`/course/detail/${id}`,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //批量删除课程
  batchRemoveCourse(idList){
    return request({
      url:`/course/batchDelCourse`,
      method:'DELETE',
      data:idList,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //新增视频
  addCourseVideo(courseVideo){
    return request({
      url:'/course/addPart',
      method:'POST',
      data:courseVideo,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //批量导出课程
  importcourse(){
    return request({
      url:'/course/exportData',
      method:'GET',
      headers: {
              'Authorization':getToken()
            }
    })
  }
}
